package 集合进阶.双列集合.HashMap集合;

import java.util.HashMap;
import java.util.Map;

public class 练习一 {
    public static void main(String[] args) {
        //1.创建一个HashMap集合对象
        Map<Student,String> map=new HashMap<>();

        //2.创建3个学生对象
        Student stu1=new Student("张三",23);
        Student stu2=new Student("张三",23);
        Student stu3=new Student("王五",23);

        //3.添加到map集合中
        map.put(stu1,"四川");
        map.put(stu2,"贵州");
        map.put(stu3,"河北");

        //遍历map集合
        map.forEach((student, s) -> System.out.println(student.getName()+","+s));
    }
}
